﻿using System;
using System.Collections.Generic;
using System.Text;

namespace ProcrastinationKit.Connectivity.Configuration
{
    public class PKSettingsCollection: System.Configuration.ConfigurationElementCollection
    {

        public new PKSettings this[string name]
        {
            get
            {
                foreach (PKSettings setting in (this as System.Collections.IEnumerable))
                    if (setting.Name == name)
                        return setting;

                return null;
            }
            set
            {
                //if (base.BaseGet(index) != null)
                //{
                //    base.BaseRemoveAt(index);
                //}
                //this.BaseAdd(index, value);
            }
        }

        protected override System.Configuration.ConfigurationElement CreateNewElement()
        {
            return new PKSettings();
        }

        protected override object GetElementKey(System.Configuration.ConfigurationElement element)
        {
            return ((PKSettings)element).ElementInformation;
        }
    }
}
